<?php 
include ("../graficas/lib/jpgraph.php"); 
include ("../graficas/lib/jpgraph_pie.php");
include ("../graficas/lib/jpgraph_pie3d.php");
include ("../graficas/lib/jpgraph_bar.php"); 
include ("../graficas/lib/jpgraph_line.php");
include("consultas.php");
include ("../funciones.php");
include ('../Connections/conn.php');


$arreglo=array_recibe($_GET['r']);
$tickets=depto_ticket($_GET['id_depto'],$conexion);
$rojo=0;
$verde=0;
for($a=0;$a<mysql_num_rows($tickets);$a++)
{
	$ticket=mysql_fetch_array($tickets);
	$contador=tickets_rojo($ticket['ticket_id_ticket'],$conexion);
	if($contador==1)
		$rojo++;
	else
		$verde++;	
}



if($rojo+$verde>0)
	$data = array(($verde*100)/($rojo+$verde),($rojo*100)/($rojo+$verde)); 
else
{
	echo "No hay tickets en este departamento";
	die();  
}

$nombres = array(
        0=>"Sin Vencer",
        1=>"Vencidos");

$colores = array("black","green");

$titulo = "% Tickets Alarmados";
$ejey = "% Porcentaje";

grafica2($data, $nombres,$titulo,'',$ejey);

?> 